package hot_problems_100;

public class P14_0189 {
    /*
    * 将数组想右循环移动k个位置
    * */
    public void rotate(int[] nums, int k) {
        k = k % nums.length;
        int[] tmp = new int[nums.length];
        for(int i=0; i<nums.length; i++){
            int index = (i+k) % nums.length;
            tmp[index] = nums[i];
        }
        for(int i=0; i<nums.length; i++){
            nums[i] = tmp[i];
        }
    }
}
